CLI Overhaul and improved vocabulary ingestion#14
Draft
nicoloesch wants to merge 25 commits into
Draft
Conversation
49d3ee0 to
0533caa
Compare
… CLIs, alter docs slightly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR delivers a full structural overhaul of the
omop-alchemymaintenance CLI, motivated by accumulated complexity, duplicated boilerplate across every command, raw SQL scattered through CLI files, and documentation that was insufficient to understand how commands should be used.Fixes #12
Part 1: CLI cleanup
Backend abstraction layer
A new
omop_alchemy/backends/package introduces aBackendABC withPostgresBackendandSQLiteBackendimplementations. All dialect-specific SQL (FK trigger toggling, ANALYZE/TRUNCATE/sequence management, CLUSTER, full-text sidecar management, backup/restore command assembly) is extracted from the CLI files and centralised in the backend implementations. CLI files are now orchestration and rendering only.backend_support.pydeleted and replaced bybackend_supports/require_backend_support/BackendNotSupportedErroron the Backend base classcdm/handlers/fulltext/deleted; full-text logic absorbed intobackends/fulltext.pyandPostgresBackend@omop_commanddecoratorAn
@omop_commanddecorator in_cli_utils.pyeliminates three repeated patterns from all 18 CLI command functions: connection parameter declarations (--dotenv,--engine-schema,--db-schema),setup_cli_cmdboilerplate, andtry/except handle_errorwrappers. Command bodies now only see a resolvedconnobject and a readyengine.cli_schema.pydecomposedThe 1,500-line monolithic file was split into five single-responsibility domain modules (
cli_schema_info.py,cli_schema_doctor.py,cli_schema_reconcile.py,cli_schema_tables.py,cli_schema_summary.py). The original file is retained as a thin re-export shim so all existing callers continue to work unchanged.Documentation
docs/cli/index.md: CLI architecture overview covering the@omop_commanddecorator, connection resolution, and theconnobjectdocs/cli/reference.md: full command reference with parameter tables for all 25 commandsPart 2: Accelerated ingestion of vocabularies
** To be done**
Part 3: OA Configurator integration
PENDING
Integration with the OA Configurator will absorb the engine-creation and configuration machinery (
db.py,config.py,logger_config.py) from this package into the shared configuration tool. Thebackends/layer is configuration-agnostic by design and will slot in unchanged when this work is complete.This section will be updated when the integration is ready.